<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

//Route::get('/', function () {
//    return view('welcome');
//});
//
//Auth::routes();
//
//Route::get('/home', 'HomeController@index')->name('home');

//后台登录页面
Route::group(['namespace'=>'Admin','prefix'=>'admin'],function (){
    Route::group(['prefix'=>'login'],function (){
        //登录页面
        Route::get('index','LoginController@index')->middleware('admin.login');
        //处理登录操作
        Route::post('tologin','LoginController@tologin');
        //退出
        Route::get('logout','LoginController@logout');
    });


});
// Admin 模块
Route::group(['namespace'=>'Admin','prefix'=>'admin','middleware'=>'admin.auth'],function (){
    Route::group(['prefix'=>'index'],function (){
        //首页页面
        Route::get('index','IndexController@index');
    });


    Route::group(['prefix'=>'user'],function (){
        Route::get('index','UserController@index');#用户列表
        Route::get('destroy/{id}','UserController@destroy');#用户删除
        Route::get('disabled/{id}','UserController@disabled');#用户禁用
        Route::get('rebateBenefit/{id}','UserController@rebateBenefit');#用户收益
        Route::get('rebateDevote/{id}','UserController@rebateDevote');#用户贡献
    });


    //首页==>banner模块
    Route::group(['prefix'=>'banner'],function (){
        Route::get('index','BannerController@index');
        Route::get('destroy/{id}','BannerController@destroy')->where('id','[0-9]+');
        Route::get('create','BannerController@create');
        Route::post('store','BannerController@store');
        Route::get('edit/{id}','BannerController@edit');
        Route::post('update/{id}','BannerController@update');
    });
    //首页==>系统管理模块
    Route::group(['prefix'=>'system'],function (){
        Route::get('aboutus','SystemController@aboutus');//关于我们
        Route::get('aboutus_edit/{id}','SystemController@aboutus_edit');
        Route::post('aboutus_update/{id}','SystemController@aboutus_update');
    });

    //商品==>分类管理模块
    Route::group(['prefix'=>'goods'],function (){
        Route::get('category','GoodsController@category');
        Route::get('create','GoodsController@create');
        Route::post('cate_store','GoodsController@cate_store');
        Route::get('cate_destory/{id}','GoodsController@cate_destory');
        Route::get('cate_edit/{id}','GoodsController@cate_edit');
        Route::post('cate_update/{id}','GoodsController@cate_update');
    });

    //商品==>商品管理模块
    Route::group(['prefix'=>'spu'],function (){
        //商品列表首页
        Route::get('index','SpuController@index');
        //商品创建页面
        Route::get('create','SpuController@create_form');
        //商品编辑页面
        Route::get('edit/{spu_id}','SpuController@edit_form');
        //商品创建
        Route::post('docreate','SpuController@docreate');
        //商品图片上传
        Route::post('uploadImg','SpuController@uploadImg');
        //商品的删除图片功能
        Route::post('delImg','SpuController@deleteImg');
        //商品的bootstrapfileinput初始化图片列表的配置获取
        Route::get('bsconfig/{spu_id}','SpuController@bsImgConfig');
    });

    //规格管理
    Route::group(['prefix'=>'property'],function (){
        //商品规格首页
        Route::get('index','PropertyController@index');
        //规格创建页面
        Route::get('create','PropertyController@create_form');
        //规格编辑页面
        Route::get('update/{props_id}','PropertyController@update_form');
        //规格创建方法
        Route::post('docreate','PropertyController@create');
        //规格编辑方法
        Route::post('doupdate','PropertyController@update');
        //规格编辑方法
        Route::get('delete/{props_id}','PropertyController@delete');
    });

    //商品==>分类管理模块
    Route::group(['prefix'=>'comment'],function (){
        Route::get('index','CommentController@index');
        Route::get('destory/{id}','CommentController@destory');
    });

    //订单管理模块
    Route::group(['prefix'=>'order'],function (){
        Route::get('index','OrderController@index');

    });
});
